package org.dromara.bclt.dubbo;

import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.bclt.api.RemoteDeviceInfoService;
import org.dromara.bclt.api.model.DeviceInfo;
import org.dromara.bclt.domain.vo.DeviceInfoVo;
import org.dromara.bclt.service.IDeviceInfoService;
import org.springframework.stereotype.Service;


/**
 * 设备信息
 *
 * @author RRyuan
 */

@RequiredArgsConstructor
@Service
@DubboService
public class RemoteDeviceInfoServiceImpl implements RemoteDeviceInfoService {

    private final IDeviceInfoService deviceInfoService;


    @Override
    public String selectUserNameById(Long id) {
        return deviceInfoService.selectNameById(id);
    }

    @Override
    public String selectDeviceNumberById(Long id) {
        return deviceInfoService.selectDeviceNumberById(id);
    }


    @Override
    public Long selectIdByName(String name) {
        return deviceInfoService.selectIdByName(name);
    }


    /**
     * 构建登录用户
     */
    private DeviceInfo buildDeviceinfo(DeviceInfoVo deviceinfoVo) {
        DeviceInfo deviceinfo = new DeviceInfo();
        deviceinfo.setId(deviceinfoVo.getId());
        deviceinfo.setName(deviceinfoVo.getName());
        deviceinfo.setSex(deviceinfoVo.getSex());
        deviceinfo.setDeviceNumber(deviceinfoVo.getDeviceNumber());
        deviceinfo.setAddress(deviceinfoVo.getAddress());
        deviceinfo.setAge(deviceinfoVo.getAge());
        deviceinfo.setHight(deviceinfoVo.getHeight());
        deviceinfo.setWeight(deviceinfoVo.getWeight());
        deviceinfo.setRemark(deviceinfoVo.getRemark());

        return deviceinfo;
    }
}
